<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>登录</title>
  <!-- 引入facicon.ico网页图标 -->
<link rel="shortcut icon" href="favicon.ico"  type="image/x-icon"/> 
  <!-- 引入 layui.css -->
  <link rel="stylesheet" href="/layui/dist/css/layui.css">
  <link rel="stylesheet" href="/css/style.css">
  <link rel="stylesheet" href="/layui/dist/css/login.css">
</head>
<body>
  <div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">

    <div class="layadmin-user-login-main">
      <div class="layadmin-user-login-box layadmin-user-login-header">
        <h2>欢迎登录</h2>
        <p><small>密码：2320</small></p>
      </div>
      <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
        <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="userName"></label>
          <input type="text" name="username" id="userName" value="Record" lay-verify="required" placeholder="用户名" class="layui-input">
        </div>
        <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="password"></label>
          <input type="password" name="password" id="password" lay-verify="required" placeholder="密码" class="layui-input">
        </div>
        <div class="layui-form-item" style="margin-bottom: 20px;">
          <input type="checkbox" name="remember"  id="rememberMe" lay-skin="primary" title="记住密码" onclick="forget1()" >
          <a href="#" class="layadmin-user-jump-change layadmin-link" style="margin-top: 7px;" onclick="forget()">忘记密码？</a>
        </div>
        <div class="layui-form-item">
          <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-login-submit" onclick="login()">登 入</button>
        </div>
      </div>
    </div>
    
    
    
    
  </div>
<!-- 引入 layui.js -->
<script src="/layui/dist/layui.js"></script>
<script>
   var $ = layui.$;
   var password = sessionStorage.getItem("password");
   $("#password").val(password);
   if(password == 2320){
    $('#rememberMe').prop('checked',true);
   }
  function login() {
    
    var userName = $("#userName").val();
    var password = $("#password").val();
    
    if(userName == 'Record' && password == '2320'){
        sessionStorage.setItem("token",'123');
        if($('#rememberMe').prop('checked') == true){
        sessionStorage.setItem("password",password);
        }else{
          sessionStorage.removeItem("password");
        }
        layer.msg('登录成功', {icon: 1}); 
        setTimeout(function(){
          window.location.replace('main.html')
        },1500)
        
    }else{
        layer.msg('账号或密码错误', {icon: 2,time:1000,anim: 6}); 
    }
}
  function forget(){
    layer.alert('密码： 2320');
  }
  
  
</script> 
</body>
</html>